<?php Schema::init(); ?>
<div class="schema_wrapper">
	<?php if ($error != -1) { ?>
		<div class="schema_message">
		<?php if (!$error) {
			Backend::infoMessage(__('Document deleted sucsesfuly'));
		} else {
			Backend::errorMessage(__('Error deleting document'));
		} ?>
		</div>
	<?php } else { ?>
		<div class="schema_header">
			<?php echo __('Delete document "{%document_name%}"?', array('document_name' => $info['name'])); ?>
		</div>
		<form action="<?php echo CURRENT_URL, $info['id'] . '/' . $cat_id; ?>" method="post">
		<?php if (count($cat_list) > 0) { ?>
			<label class="radio">
				<input type="radio" name="delete_from" id="delete_from_1" value="1"<?php if (!$cat_id) {?> checked="true"<?php } ?> onclick="$('#delete_info_2').hide();">
				<?php echo __('Delete completely'); ?>
			</label>
			<label class="radio">
				<input type="radio" name="delete_from" id="delete_from_2" value="2"<?php if ($cat_id > 0) {?> checked="true"<?php } ?> onclick="$('#delete_info_2').show();">
				<?php echo __('Delete from categories'); ?>
			</label>
			<div id="delete_info_2" style="padding:0px 0px 10px 0px;<?php if (!$cat_id) {?> display:none;<?php } ?>">
				<div style="border:1px solid #000; padding:10px;">
				<?php foreach ($cat_list as $cat) {
					$checked = '';
					if (intval($cat_id) == intval($cat['id'])) {
						$checked = ' checked="true"';
					} ?>
					<label class="checkbox">
						<input type="checkbox" name="delete_from_cats[]" value="<?php echo $cat['id']; ?>" <?php echo $checked; ?> />
						<?php echo $cat['path']; ?>
					</label>
				<?php } ?>
				</div>
			</div>
		<?php } else { ?>
			<input type="hidden" name="delete_from" value="1" />
		<?php } ?>
			<div class="schema_buttons">
				<input type="submit" value="<?php echo __('Delete'); ?>" class="btn btn-primary" />
				<input type="button" value="<?php echo __('Cancel'); ?>" class="btn" onclick="history.back()" />
			</div>
		</form>
	<?php } ?>
</div>